package com.wingsfrog.travel.modules.dao;

import com.wingsfrog.travel.modules.entity.Task;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

/**
 * Created by rankin on 16/3/30.
 */
public interface TaskDao extends CrudRepository<Task,Integer>{

    @Query("select sum(t.taskScore) from Task t where t.mainTaskId = ?1")
    public Long findSumByMainTaskIdEndingWith(Integer mainTaskId);

    public Task findByMainTaskIdAndSequence(Integer taskId,Integer sequence);

    @Query("select count(t) from Task t where t.mainTaskId = ?1 ")
    public Long getCountByMainTaskId(Integer mainTaskId);
}
